package com.seecen.controller;

import com.seecen.common.BaseResponse;
import com.seecen.service.CurtainOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 窗帘安装订单控制器
 * @author admin
 * @create 2025-10-22 15:30:48
 */
@RestController
@Slf4j
@RequestMapping("/curtain-order")
public class CurtainOrderController {
    
    @Autowired
    private CurtainOrderService curtainOrderService;
    
    // 创建窗帘安装订单
    @PostMapping("/create")
    public BaseResponse<?> createCurtainOrder(@RequestBody Map<String, Object> orderData) {
        log.info("Controller: 创建窗帘订单请求，订单数据: {}", orderData);
        return curtainOrderService.createCurtainOrder(orderData);
    }
    
    // 获取窗帘订单详情
    @GetMapping("/detail/{orderId}")
    public BaseResponse<?> getCurtainOrderDetail(@PathVariable Long orderId) {
        log.info("Controller: 获取窗帘订单详情请求，订单ID: {}", orderId);
        return curtainOrderService.getCurtainOrderDetail(orderId);
    }
    
    // 更新窗帘订单
    @PutMapping("/update/{orderId}")
    public BaseResponse<?> updateCurtainOrder(@PathVariable Long orderId, @RequestBody Map<String, Object> orderData) {
        log.info("Controller: 更新窗帘订单请求，订单ID: {}, 数据: {}", orderId, orderData);
        return curtainOrderService.updateCurtainOrder(orderId, orderData);
    }
}
